// 又是Promise.race了

function fast(promises) {
    return Promise.race(promises)
}


// 模拟两个请求
const req1 = new Promise((resolve, reject) => {
    setTimeout(() => {
        resolve('1')
    },1000)
})
const req2 = new Promise((resolve, reject) => {
    setTimeout(() => {
        resolve('2')
    },2000)
})
fast([req2,req1]).then(res=>{
    console.log(res)
})
